#include "sys_tick.h"
#include "io.h"
#include "time.h"

#define ONE_SENCOND (1000)

#define HAL_SYS_TIMER_PERIODIC (5)

err_t systick_init(void)
{
    SysTick_Config( SystemCoreClock / (ONE_SENCOND / HAL_SYS_TIMER_PERIODIC) );
  
    return 0;
}

size_t tick_read(void)
{
    return SysTick->VAL;
}

void SysTick_Handler(void)
{
    extern void os_timetick(void);
  
    os_timetick();
}
